define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {

		//返回信息
		return {
			// 获取用户数据(“企业资料”用到)
			get_relogin: function(callback, error) {
				Http.httprelogin(callback, error);
			},
			
			// 获取用户数据(“企业资料”用到)
			get_AuthInfo: function(param, callback, error, done) {
				param = param || {}
				param.method = 'member.get';
				Http.post(param, callback, error, done);
			},
			
			// 取得买家订单数量等
			getBuyerInfo: function(param, callback, error, done) {
				param = param || {}
				param.method = 'member.center.getBuyerInfo';//member.order.getcount
				//post请求
				Http.get(param, callback, error, done);
			},

			// 取得卖家订单数量等
			getSellerInfo: function(param, callback, error, done) {
				param = param || {}
				param.method = 'member.center.getSellerInfo';//trades.order.count.get
				//post请求
				Http.get(param, callback, error, done);
			},
			//身份	1:旗舰店，2:品牌分销店，3:分销店/分仓	4:加盟店  5:终端
			//isWare:是否需要判断分仓。true:不需要    false:需要(只有商品管理、我的加盟店、我的供应商3个需要判断分仓)
			get_menus: function(callback) {
				var data = new Object();
				data.menus = [{
						icon: "ion-ios-cart",
						title: "商品管理",
						value: "productmanager",
						type: [1,2,3,4],
						isWare:false,
						authname:['品牌管理','销售中商品','待上架商品','自定义分类']
					}, {
						icon: "ion-ios-flag",
						title: "我的授权中心",//我的供应商-->我的分销店-->我的授权中心
						value: "myagent",
						type: [1,2],
						isWare:true,
						authname:['授权中心一览','授信还款','我要找授权中心']
					}, {
						icon: "ion-ios-color-filter",
						title: "我的加盟店",
						value: "distributor",
						type: [3],
						isWare:false,
						authname:['加盟店一览','授信还款','我要找加盟店']
					}
					/*, {
										icon: "./icon/guilin/myworldindex/myworldindex04.png",
										title: "我的旗舰店",
										value: "sxqd",
										type: 3
									}*/
					, {
						icon: "ion-ios-people",
						title: "我的供应商",
						value: "mybrandoperator",
						type: [3],
						isWare:false,
						authname:['all']//供应商一览
					}, {
						icon: "ion-ios-people",
						title: "我的供应商",//我的分销店-->我的授权中心
						value: "distributor_sxqd",
						type: [4],
						isWare:true,
						authname:['供应商一览','我要找供应商']//'授权中心一览','授信还款','我要找授权中心'
					}, {
						icon: "ion-android-playstore",
						title: "我要代理",
						value: "wanttoagent",
						type: [3],
						isWare:true,
						authname:['我要找供应商']
					}, {//经销商用 （向制造商申请）
						icon: "ion-android-globe",
						title: "品牌管理",//我要经销。    申请品牌（向授权中心）
						value: "productmanager_brand_agent_edit",//productmanager_brand_agent_edit---wanttodistributor
						type: [4],
						isWare:true,
						authname:['品牌管理']//我要找供应商
					}, {//制造商用  （申请自己的品牌，不过需要平台审核）
						icon: "ion-android-globe",
						title: "品牌管理",
						value: "productmanager_brand_edit",
						type: [1],
						isWare:true,
						authname:['品牌管理']
					}/*, {
						icon: "./icon/guilin/myworldindex/myworldindex08.png",
						title: "促销",
						value: "sales",
						type: [1,2,3],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex09.png",
						title: "限时抢购",
						value: "purchase",
						type: [1,2,3,4],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex10.png",
						title: "团购",
						value: "mygroupbuy",
						type: [1,2,3,4],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex11.png",
						title: "秒杀",
						value: "secondkill",
						type: [1,2,3,4],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex12.png",
						title: "拍卖",
						value: "auctiontrade",
						type: [1,2,3,4],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex13.png",
						title: "新品测试",
						value: "test",
						type: [1,2,3,4,5],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex14.png",
						title: "新品赠送",
						value: "newpro_present",
						type: [1,2,3,4,5],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex15.png",
						title: "新品广告",
						value: "newpro_ads",
						type: [1,2],
						isWare:true
					}*/, {
						icon: "ion-podium",
						title: "明星企业",
						value: "starbusiness_publicity",
						type: [1,2],
						isWare:true,
						authname:['企业视频']
					}, {
						icon: "ion-person-stalker",
						title: "我的好友",
						value: "myfriend",
						type: [4],
						isWare:true,
						authname:['好友一览','黑名单']
					}/*, {
						icon: "./icon/guilin/myworldindex/myworldindex18.png",
						title: "好友店铺",
						value: "myfriendjxs",
						type: [1,2,3,5],//1,2,3,4,5
						isWare:true,
						authname:['all']
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex19.png",
						title: "我的求购",
						value: "pbuy",
						type: [1,2,3,4],
						isWare:true,
						authname:['all']
					}*/, {
						icon: "icon-ticket",
						title: "优惠券",
						value: "issuediscount",
						type: [1,2,3,4],
						isWare:true,
						authname:['优惠券一览']
					}, {
						icon: "ion-android-send",
						title: "推送消息",
						value: "starbusiness_pushinfo",
						type: [1,2],
						isWare:true,
						authname:['推送消息']
					}, {
						icon: "ion-person-add",
						title: "店员管理",
						value: "employeemanager",
						type: [1,2,3,4],
						isWare:true,
						authname:['店员管理','角色管理']
					}, /*{
						icon: "./icon/guilin/myworldindex/myworldindex22.png",
						title: "我的群",
						value: "",
						type: [1,2,3,4],
						isWare:true
					}, {
						icon: "./icon/guilin/myworldindex/myworldindex23.png",
						title: "我的论坛",
						value: "myproduct",
						type: [1,2,3,4],
						isWare:true
					},*/ {
						icon: "ion-search",
						title: "我要招员工",
						value: "recruitment",
						type: [1,2,3,4],
						isWare:true,
						authname:['我要招员工']
					}
				];
				//函数回调
				if(callback)
					callback(data);
			}
			
			
			
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Center", factory);
});